﻿using System.Drawing;

namespace Minecraft_2D.Blocks
{
    class Bloc
    {
        #region Attributs
        private int _id;
        private string _name;
        private Bitmap _image;
        private bool _isOpaque;
        private int _percent;
        #endregion

        #region Constructeur
        public Bloc(string name, Bitmap image, bool isOpaque, int percent)
        {
            //_id = BlockSet.GetSingleton().Count;
            _name = name;
            _image = image;
            _isOpaque = isOpaque;
            _percent = percent;
        }
        #endregion

        #region Proprietes
        public int Id
        {
            get { return _id; }
        }

        public string Name
        {
            get { return _name; }
        }

        public Bitmap Image
        {
            get { return _image; }
        }

        public bool IsOpaque
        {
            get { return _isOpaque; }
        }

        public int Percent
        {
            get { return _percent; }
        }
        #endregion

        #region Methodes
        public void SetId()
        {
            _id = BlocSet.GetSingleton().Count;
        }

        public virtual TypeBloc OnNew(Block bloc)
        {
            return TypeBloc.Air;
        }

        public virtual bool IsOK(Block bloc)
        {
            return true;
        }

        public virtual void Remove(Block bloc)
        {
            bloc.Type = TypeBloc.Air;
        }
        #endregion
    }
}
